home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / fontutil.6 / fontutil / fontutils-0.6 / limn / pxl-outline.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-27  |  2.2 KB  |  72 lines

  1. /* pxl-outline.h: find a list of outlines which make up one character.
  2.  
  3. Copyright (C) 1992 Free Software Foundation, Inc.
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef PXL_OUTLINE_H
  20. #define PXL_OUTLINE_H
  21.  
  22. #include "font.h"
  23. #include "types.h"
  24.  
  25.  
  26. /* This is a list of contiguous points on the bitmap.  */
  27. typedef struct
  28. {
  29.   coordinate_type *data;
  30.   unsigned length;
  31.   boolean clockwise;
  32. } pixel_outline_type;
  33.  
  34. /* The Nth coordinate in the list.  */
  35. #define O_COORDINATE(p_o, n) ((p_o).data[n])
  36.  
  37. /* The length of the list.  */
  38. #define O_LENGTH(p_o) ((p_o).length)
  39.  
  40. /* Whether the outline moves clockwise or counterclockwise.  */
  41. #define O_CLOCKWISE(p_o) ((p_o).clockwise)
  42.  
  43. /* Since a pixel outline is cyclic, the index of thenext coordinate
  44.    after the last is the first, and the previous coordinate before the
  45.    first is the last.  */
  46. #define O_NEXT(p_o, n) (((n) + 1) % O_LENGTH (p_o))
  47. #define O_PREV(p_o, n) ((n) == 0                \
  48.                          ? O_LENGTH (p_o) - 1            \
  49.                          : (n) - 1)
  50.    
  51. /* And the character turns into a list of such lists.  */
  52. typedef struct
  53. {
  54.   pixel_outline_type *data;
  55.   unsigned length;
  56. } pixel_outline_list_type;
  57.  
  58. /* The Nth list in the list of lists.  */
  59. #define O_LIST_OUTLINE(p_o_l, n) ((p_o_l).data[n])
  60.  
  61. /* The length of the list of lists.  */
  62. #define O_LIST_LENGTH(p_o_l) ((p_o_l).length)
  63.  
  64.  
  65. /* Find all pixels on the outline in the character C.  */
  66. extern pixel_outline_list_type find_outline_pixels (char_info_type c);
  67.  
  68. /* Free the memory in the list.  */
  69. extern void free_pixel_outline_list (pixel_outline_list_type *);
  70.  
  71. #endif /* not PXL_OUTLINE_H */
  72.